package com.candy.candymember.event;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

/**
 * @author suYanLong
 * @date 2022年10月14日 14:27
 */
@Slf4j
@Component
public class ScoreListener implements ApplicationListener<ScoreEvent> {

    @Override
    public void onApplicationEvent(ScoreEvent scoreEvent) {
        log.info("收到 事件。。。。");
        log.info("score事件");
        System.out.println(scoreEvent.getName());
        System.out.println(scoreEvent.getScore());
    }

    @EventListener
    public void scoreEvent(ScoreEvent scoreEvent) {
        log.info(" =============>>>> ");
        System.out.println(scoreEvent.getName());
        System.out.println(scoreEvent.getScore());
    }

}
